<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .cls{
            width: 200px;
            height: 200px;           
        }
    </style>
</head>
<body>    
    
    <div id="app">       
        <book class="cls" type="computer" @click="fn"></book>
    </div>

    <script src="./js/vue.global.js"></script>

    <script>

        let book = {     
            props:['type'],
            template:`
                 <p :class="$attrs.class">我是个一个p</p>
                 <p>我是个第二个p</p>   
                 <p @mouseover="overHandle" >我是个第三个p</p>            
            `,
            created(){
                console.log("this.$attrs",this.$attrs);
                console.log("this.$attrs.class",this.$attrs.class);
                console.log("this.$attrs.type",this.$attrs.type);
                console.log("this.$attrs.onClick",this.$attrs.onClick);//如果是事件属性，那么会在事件属性名前面加上on，并且把事件名的首字母大写
            },
            methods:{
                overHandle(){
                    this.$attrs.onClick();
                    // this.$emit("click");
                }
            }
        }
       
        let app = Vue.createApp({
            components:{
                book
            },
            data(){
                return {
                    
                }
            },
            methods:{
                fn(){
                    console.log("click.fn");
                }
            }            
        });

       
      
        app.mount("#app");

    </script>
</body>
</html>